def A(a):
    return a % 4 == 0 and (a % 100 != 0 or a % 400 == 0)

def B(a, b):
    if b == 2:
        return 29 if A(a) else 28
    elif b in [4, 6, 9, 11]:
        return 30
    else:
        return 31

def C(a, b):
    c = B(a, b)
    print(f"{a}年{b}月日历：")
    print("日  一  二 三 四 五  六")
    P = 1
    for i in range(P):
        print("   ", end="")
    for day in range(1, c + 1):
        print(f"{day:2d}", end=" ")
        if (P + day - 1) % 7 == 6:
            print()
    print("\n")

print("万年历测试：")
C(2023, 10)
print("\n")

